﻿using ReflectionStudio.Components.UserControls;
using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Data;
namespace WPFExcelReport
{ 
    public partial class GTTLS03
    {
        ApplicationBase app
        {
            get
            {
                return ApplicationBase.Instance;
            }
        }
        public DataTable TBPRG
        {
            get
            {
                return app.TBPRG;
            }
            set
            {
                app.TBPRG = value;
            }
        }
        public DataTable TBUR
        {
            get
            {
                return app.TBUR;
            }
            set
            {
                app.TBUR = value;
            }
        }

        
        public GTTLS03()
        { 
            InitializeComponent();   
            this.Name = "供应商管理";

        }
        
        private void Window_Loaded(object sender, RoutedEventArgs e)
        { 
            
        }
        public override void SetUpUserRight()
        {
            base.SetUpUserRight();
            Type mom = this.GetType();
            if (mom == null)
                return;
            string filter = "USERID='" + app.User + "' AND PROG='" + mom.Name.PadRight(80) + "'";
            DataRow[] rows = TBUR.Select(filter);
            foreach (DataRow row in rows)
            {
                string contol = row["CONTROLS"].ToString();//属性 
                string PROCESS = row["PROCESS"].ToString();//控制值
                string txt = row["P0"].ToString();//文本值 
                bool blControl = true;
                if (PROCESS.Trim() == "N")
                {
                    blControl = false; ;
                }
                if (PROCESS.Trim() == "Y")
                {
                    blControl = true; ;
                }
                switch (contol.Trim())
                {
                    case "IsCanDelete":
                        IsCanDelete = blControl;
                        break;
                    case "IsCanNew":
                        IsCanNew = blControl;
                        break; 
                    case "ScopeManage":
                        ScopeManage = txt;
                        break;
                }
            }
        }
   
    }
}
